﻿@using eLoan.Models;
@model LoanCoMakerCollateralModel
@{
    ViewBag.Title = "Loan Co-Makers and Collaterals";

}

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>Loan Co-makers and Collaterals</h2>
        <ol class="breadcrumb">
            <li>
                Funding
            </li>
            <li>
                <a href="@Url.Action("Loans", "Funding")">Loans</a>
            </li>
            <li class="active">
                <strong>Loan Co-makers and Collaterals</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2"></div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>Borrower</th>
                                <th>Document No</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>@Html.ActionLink(Model.BorrowerName, "BorrowerDetails", "Borrower", null, null, null, new { borrowerID = Model.BorrowerName, branchCode = Model.BranchCode }, null)</td>
                                <td>@Html.ActionLink(Model.DocumentNo, "LoanDetails", "Loan", null, null, null, new { documentNo = Model.DocumentNo }, null)</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="col-lg-6">
            <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h3>Loan Co-makers</h3>
                    </div>
                <div class="ibox-title">
                    <div>
                        <a href="@Url.Action("AddEdit", "LoanCoMaker", new { documentNo = Model.DocumentNo })" class="btn btn-primary">Add a new co-maker</a>
                    </div>
                </div>
                    <div class="ibox-content">
                        <div class="scrollable">
                            <table class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Address</th>
                                        <th>Contact Numbers</th>
                                        <th>ID No</th>
                                        <th colspan="2"></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @for (var i = 0; i < Model.LoanCoMakers.Count(); i++)
                                    {
                                        <tr>
                                            <td>@Html.DisplayFor(m => Model.LoanCoMakers[i].CoMakerName)</td>
                                            <td>@Html.DisplayFor(m => Model.LoanCoMakers[i].Address)</td>
                                            <td>@Html.DisplayFor(m => Model.LoanCoMakers[i].ContactNumbers)</td>
                                            <td>@Html.DisplayFor(m => Model.LoanCoMakers[i].IDNo)</td>
                                            <td>@Html.ActionLink("Edit", "AddEdit", "LoanCoMaker", null, null, null, new { id = Model.LoanCoMakers[i].ID, documentNo = Model.LoanCoMakers[i].DocumentNo }, null)</td>
                                            <td>@Html.ActionLink("Delete", "Delete", "LoanCoMaker", null, null, null, new { id = Model.LoanCoMakers[i].ID, documentNo = Model.LoanCoMakers[i].DocumentNo }, null)</td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
        </div>

        <div class="col-lg-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h3>Loan Collateral</h3>
                </div>
                <div class="ibox-title">
                    <div>
                        <a href="@Url.Action("AddEdit", "LoanCollateral", new { documentNo = Model.DocumentNo })" class="btn btn-primary">Add a new collateral</a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="scrollable">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>Make / Type</th>
                                    <th>Brand / File No</th>
                                    <th>Serial / Plate No</th>
                                    <th>Amount</th>
                                    <th colspan="2"></th>
                                </tr>
                            </thead>
                            <tbody>
                                @for (var i = 0; i < Model.LoanCollaterals.Count(); i++)
                                {     
                                <tr>
                                    <td>@Html.DisplayFor(m => Model.LoanCollaterals[i].MakeOrType)</td>
                                    <td>@Html.DisplayFor(m => Model.LoanCollaterals[i].BrandOrFileNo)</td>
                                    <td>@Html.DisplayFor(m => Model.LoanCollaterals[i].SerialOrPlateNo)</td>
                                    <td>@Html.ValueFor(m => Model.LoanCollaterals[i].Amount, "{0:#,###,##0.00}")</td>
                                    <td>@Html.ActionLink("Edit", "AddEdit", "LoanCollateral", null, null, null, new { id = Model.LoanCollaterals[i].ID, documentNo = Model.LoanCollaterals[i].DocumentNo }, null)</td>
                                    <td>@Html.ActionLink("Delete", "Delete", "LoanCollateral", null, null, null, new { id = Model.LoanCollaterals[i].ID, documentNo = Model.LoanCollaterals[i].DocumentNo }, null)</td>
                                </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section Styles {
    @Styles.Render("~/Content/plugins/dataTables/dataTablesStyles")
<style>
    .scrollable {
        height: 400px;
        overflow-y: scroll;
        border: solid 1px #EBEBEB;
    }
</style>
}
